package com.app.interceptor;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * program: appms
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小Y
 * version:1.0
 * Date:2024-09-29 10:20
 */
public class DevInterceptor extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if (request.getSession().getAttribute("devlogin") == null) {
            response.sendRedirect( request.getContextPath() + "/warn.jsp");
            return false;
        }
        return true;
    }
}
